package com.yjz.designpattern.strategy_pattern.strategy;

import com.yjz.designpattern.strategy_pattern.model.LaunchPayCommand;
import com.yjz.designpattern.strategy_pattern.model.LaunchPayResultBo;
import com.yjz.designpattern.strategy_pattern.model.LaunchPayResultDo;
import com.yjz.designpattern.strategy_pattern.model.OrderLaunchPaymentDo;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @author: yuanjinzhong
 * @date: 2022/10/12 7:21 PM
 * @description: 拉起收银台
 */
@Slf4j
public abstract class LaunchPayStrategy {


  /**
   * 业务场景校验
   *
   * @param launchPayCommand
   * @param orderLaunchPayment
   */
  protected abstract void check(
      LaunchPayCommand launchPayCommand, OrderLaunchPaymentDo orderLaunchPayment);

  /**
   * 支持与否
   *
   * @param bizType
   * @return
   */
  public abstract boolean support(CashierBizTypeEnum bizType);

  /**
   * 发起支付
   *
   * @param launchPayCommand
   * @param orderLaunchPaymentDo
   * @return
   */
  protected abstract LaunchPayResultDo launchPay(
      LaunchPayCommand launchPayCommand, OrderLaunchPaymentDo orderLaunchPaymentDo);

  protected abstract Map<String, Object> riskCheckForLunchPayment(
      LaunchPayCommand launchPayCommand);

  /**
   * 发起支付组装逻辑
   *
   * @param launchPayCommand
   * @param orderLaunchPayment
   * @return
   */
  public final LaunchPayResultBo doLaunchPay(
          LaunchPayCommand launchPayCommand, OrderLaunchPaymentDo orderLaunchPayment) {


    /**
     * 模板方法业务逻辑编排
     *
     * riskCheckForLunchPayment
     *
     * launchPay
     *
     */


    return  new LaunchPayResultBo();
  }


}
